restrict unshared variables and functions to file scope.
/**************************************************************************/
static gbfile* fin = nullptr, *fout = nullptr;
-struct wprdata WPR;
-struct trldata TRL;
+static struct wprdata WPR;
+static struct trldata TRL;
static arglist_t wpr_args[] = {
/*
char* name;
} roadchange;
-roadchange* roadchanges = nullptr;
+static roadchange* roadchanges = nullptr;
static
arglist_t an1_args[] = {
static an1_waypoint_record* Alloc_AN1_Waypoint();
-void Destroy_AN1_Waypoint(void* vwpt)
+static void Destroy_AN1_Waypoint(void* vwpt)
{
an1_waypoint_record* wpt = (an1_waypoint_record*)vwpt;
xfree(vwpt);
}
-void Copy_AN1_Waypoint(void** vdwpt, void* vwpt)
+static void Copy_AN1_Waypoint(void** vdwpt, void* vwpt)
{
an1_waypoint_record* wpt = (an1_waypoint_record*)vwpt;
an1_waypoint_record* dwpt = Alloc_AN1_Waypoint();
static an1_vertex_record* Alloc_AN1_Vertex();
-void Destroy_AN1_Vertex(void* vvertex)
+static void Destroy_AN1_Vertex(void* vvertex)
{
xfree(vvertex);
}
-void Copy_AN1_Vertex(void** vdvert, void* vvert)
+static void Copy_AN1_Vertex(void** vdvert, void* vvert)
{
an1_vertex_record* vert = (an1_vertex_record*)vvert;
an1_vertex_record* dvert = Alloc_AN1_Vertex();
static an1_line_record* Alloc_AN1_Line();
-void Destroy_AN1_Line(void* vline)
+static void Destroy_AN1_Line(void* vline)
{
an1_line_record* line = (an1_line_record*)vline;
xfree(line->name);
xfree(vline);
}
-void Copy_AN1_Line(void** vdline, void* vline)
+static void Copy_AN1_Line(void** vdline, void* vline)
{
an1_line_record* line = (an1_line_record*)vline;
an1_line_record* dline = Alloc_AN1_Line();
*/
-struct defguid {
+static struct defguid {
GUID guid;
const char* name;
} default_guids[] = {
},
};
-int FindIconByName(const char* name, GUID* guid)
+static int FindIconByName(const char* name, GUID* guid)
{
unsigned int i = 0;
for (i = 0; i < (sizeof(default_guids)/sizeof(struct defguid)); i++) {
return 0;
}
-int FindIconByGuid(GUID* guid, char** name)
+static int FindIconByGuid(GUID* guid, char** name)
{
unsigned int i = 0;
for (i = 0; i < (sizeof(default_guids)/sizeof(struct defguid)); i++) {
arcdist_arc_disp_wpt_cb(nullptr);
}
-void
+static void
arcdist_process()
{
queue* elem, * tmp;
}
}
-void
+static void
arcdist_init(const char*)
{
char* fm;
}
}
-void
+static void
arcdist_deinit()
{
/* do nothing */
*east = E;
}
-void
+static void
bcr_mercator_to_wgs84(const int north, const int east, double* lat, double* lon)
{
*lat = 2 * (atan(exp(north / radius)) - M_PI / 4) / M_PI * (double)180;
{
}
-void bcr_write_line(gbfile* fout, const QString& key, int* index, const QString& value)
+static void bcr_write_line(gbfile* fout, const QString& key, int* index, const QString& value)
{
if (value.isEmpty()) { /* this is mostly used in the world of windows */
/* so we respectfully add a CR/LF on each line */
st_sample_spd,
num_states
} state_t;
-state_t state;
+static state_t state;
#if __cplusplus
inline state_t operator++(state_t& rs, int)
{
const char* icon;
} icon_mapping_t;
-icon_mapping_t bushnell_icons[] = {
+static icon_mapping_t bushnell_icons[] = {
{ 0x00, "Yellow Square"},
{ 0x01, "Blue Grey Circle" },
{ 0x02, "Yellow Diamond" },
const char* text; /* Textual description for debugging */
};
-struct dg100_command dg100_commands[] = {
+static struct dg100_command dg100_commands[] = {
{ dg100cmd_getfile, 2, 1024, 2, "getfile" },
/* the getfileheader answer has variable length, -1 is a dummy value */
{ dg100cmd_getfileheader, 2, -1, 2, "getfileheader" },
{ dg100cmd_gpsmouse, 1, 0, 0, "gpsmouse" }
};
-struct dg100_command dg200_commands[] = {
+static struct dg100_command dg200_commands[] = {
{ dg100cmd_getfile, 2, 1024, 2, "getfile" },
/* the getfileheader answer has variable length, -1 is a dummy value */
{ dg100cmd_getfileheader, 2, -1, 2, "getfileheader" },
return (tree);
}
-void
+static void
free_tree(btree_node* tree)
{
if (tree->left) {
file_in = gbfopen_le(fname, "rb", MYNAME);
}
-int32_t decToEnigmaPosition(double val)
+static int32_t decToEnigmaPosition(double val)
{
int degrees = fabs(val);
double frac = fabs(val) - degrees;
return sign * (enigmadeg + enigmafrac);
}
-float enigmaPositionToDec(int32_t val)
+static float enigmaPositionToDec(int32_t val)
{
int deg = abs(val) / 180000;
int enigmafrac = abs(val) % 180000;
static gbfile* fin, *fout;
static queue exif_apps;
static exif_app_t* exif_app;
-const Waypoint* exif_wpt_ref;
-time_t exif_time_ref;
+static const Waypoint* exif_wpt_ref;
+static time_t exif_time_ref;
static char exif_success;
static QString exif_fout_name;
static uint8_t writer_gps_tag_version[4] = {2, 0, 0, 0};
-arglist_t exif_args[] = {
+static arglist_t exif_args[] = {
{ "filename", &opt_filename, "Set waypoint name to source filename", "Y", ARGTYPE_BOOL, ARG_NOMINMAX, nullptr },
{ "frame", &opt_frame, "Time-frame (in seconds)", "10", ARGTYPE_INT, "0", nullptr, nullptr },
{ "name", &opt_name, "Locate waypoint for tagging by this name", nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr },
static inifile_t* inifile;
static const char myname[] = "explorist";
-const char*
+#ifdef DEAD_CODE_IS_REBORN
+static const char*
explorist_read_value(const char* section, const char* key)
{
return inifile_readstr(inifile, section, key);
}
+#endif
static mag_info*
explorist_ini_try(const char* path)
// returns 1 if the waypoint's start_time can be found
// in the laps array, 0 otherwise
-unsigned int checkWayPointIsAtSplit(Waypoint* wpt, GPS_PLap* laps, int nlaps)
+static unsigned int checkWayPointIsAtSplit(Waypoint* wpt, GPS_PLap* laps, int nlaps)
{
int result = 0;
* If we're using smart names, try to put the cache info in the
* description.
*/
-const char*
+static const char*
get_gc_info(Waypoint* wpt)
{
if (global_opts.smart_names) {
static xg_callback device_s, id_s, path_s, ext_s, base_s, dir_s;
jmp_buf gdx_jmp_buf;
-void type_s(xg_string args, const QXmlStreamAttributes*)
+static void type_s(xg_string args, const QXmlStreamAttributes*)
{
type = args.compare(QLatin1String("GPSData"));
}
static char* gdb_fread_cstr(gbfile* fin);
-QString fread_cstr()
+static QString fread_cstr()
{
QString rv;
char* s = gdb_fread_cstr(fin);
/*******************************************************************************/
/* TOOLS AND MACROS FOR THE WRITER */
/*-----------------------------------------------------------------------------*/
-void FWRITE_CSTR(QString a) {
+static void FWRITE_CSTR(QString a) {
if (a.isEmpty()) {
gbfputc(0, fout);
return;
#define MYNAME "geo"
// This really should be class-local...
-QXmlStreamReader reader;
-QString geo_read_fname;
+static QXmlStreamReader reader;
+static QString geo_read_fname;
-geocache_container wpt_container(const QString&);
+static geocache_container wpt_container(const QString&);
-void GeoReadLoc()
+static void GeoReadLoc()
{
Waypoint* wpt = nullptr;
QString current_tag;
input_file_name = fname;
}
-QJsonArray* feature_collection = nullptr;
+static QJsonArray* feature_collection = nullptr;
static void
geojson_wr_init(const QString& fname) {
static int goog_step = 0;
-long
+static long
decode_goog64(const QByteArray& str, int& pos)
{
long result = 0;
static gbfile* fin, *fout;
static struct tm tm,filenamedate, trackdate;
-time_t tx;
+static time_t tx;
static char* optdate=nullptr;
static char* optmaxspeed=nullptr;
static char* optminspeed=nullptr;
#define CHECK_BOOL(a) if (a && (*a == '0')) a = NULL
-int gopal_check_line(char* line)
+static int gopal_check_line(char* line)
{
char* c = line;
int i = 0;
static int elevation_precision;
// static char* gpx_version = NULL;
-QString gpx_version;
+static QString gpx_version;
static char* gpx_wversion;
static int gpx_wversion_num;
static QXmlStreamAttributes gpx_namespace_attribute;
{type, 0, "/gpx/" name}, \
{type, 0, "/gpx/metadata/" name}
-tag_mapping tag_path_map[] = {
+static tag_mapping tag_path_map[] = {
{ tt_gpx, 0, "/gpx" },
METATAG(tt_name, "name"),
METATAG(tt_desc, "desc"),
};
// Maintain a fast mapping from full tag names to the struct above.
-QHash<QString, tag_mapping*> hash;
+static QHash<QString, tag_mapping*> hash;
static tag_type
get_tag(const QString& t, int* passthrough)
mkshort_del_handle(&mkshort_handle);
}
-void
+static void
gpx_read()
{
for (bool atEnd = false; !reader->atEnd() && !atEnd;) {
#define fread_single(a) gbfgetflt(a)
#define fread_double(a) gbfgetdbl(a)
-QString
+static QString
fread_string(gbfile* fd)
{
char* val;
fread_string(fd);
}
-QString
+static QString
fread_fixedstring(gbfile* fd, int len)
{
char* val = (char*) xmalloc(len+1);
}
}
-void
+static void
fwrite_fixedstring(gbfile* fd, const char* str, int fieldlen)
{
int len = str ? strlen(str) : 0;
}
}
-void
+static void
fwrite_fixedstring(gbfile* fd, const QString& str, int fieldlen)
{
fwrite_fixedstring(fd, CSTR(str), fieldlen);
116 // < 263 : Wake Eniwetok 1960
};
-void set_datum(int n)
+static void set_datum(int n)
{
indatum = -1;
if (n > 0 && n < MAX_INDATUM_INDEX) {
};
-void convert_datum(double* lat, double* lon)
+static void convert_datum(double* lat, double* lon)
{
double amt;
if (indatum != -1 && indatum != 118) {
CET_CHARSET_ASCII, 0, /* CET-REVIEW */
NULL_POS_OPS,
nullptr
-};
\ No newline at end of file
+};
}
-void
+static void
gtc_write()
{
gtc_write_xml(0, "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\" ?>\n");
-const char* mknshort(const char* stIn,unsigned int sLen)
+static const char* mknshort(const char* stIn,unsigned int sLen)
{
#define MAX_STRINGLEN 255
static char strOut[MAX_STRINGLEN];
// Write src unicode str to the dst cstring using unicode characters
// All lengths are in bytes
-unsigned int print_unicode(char* dst, const unsigned int dst_max_length, short* src, unsigned int src_len)
+static unsigned int print_unicode(char* dst, const unsigned int dst_max_length, short* src, unsigned int src_len)
{
// Check to see what length we were passed, if the length doesn't include the null
// then we make it include the null
// string, validate that the use of the CET library provides
// conmforming output, remove my old junk converter code.
-unsigned int ascii_to_unicode_2(char* dst, const unsigned int dst_max_length, const char* src)
+static unsigned int ascii_to_unicode_2(char* dst, const unsigned int dst_max_length, const char* src)
{
short* unicode;
int len;
return len;
}
-void write_header()
+static void write_header()
{
char header[IGO8_HEADER_SIZE] = {'\0'};
igo8_id_block tmp_id_block;
#define GPSBABEL_SUBDIR ".gpsbabel"
/* Remember the filename we used so we can include it in errors. */
-QString gbinipathname;
+static QString gbinipathname;
static QString
find_gpsbabel_inifile(const QString& path) /* can be empty or NULL */
#define MYNAME "Interpolate filter"
static char* opt_interval = nullptr;
-unsigned int interval = 0;
+static unsigned int interval = 0;
static char* opt_dist = nullptr;
-double dist = 0;
+static double dist = 0;
static char* opt_route = nullptr;
static
ARG_TERMINATOR
};
-void
+static void
interpfilt_process()
{
queue* backuproute = nullptr;
xfree(backuproute);
}
-void
+static void
interpfilt_init(const char*)
{
// mysterious, but not worth tracking down at this time. When xcode 4 comes
// along (or anyone really cares about mega performance of this fairly obscure
// target, we should revisit this.
-double
+static double
deg_min_to_deg(volatile uint32_t x)
{
double sign;
/*
Convert degrees to the degrees format of itracku.
*/
-uint32_t
+static uint32_t
deg_to_deg_min(double x)
{
int32_t sign;
Returns gbser_OK if the initialization is sucessful, a
non-zero integer otherwise.
*/
-int
+static int
init_device()
{
int rc;
}
-void
+static void
kml_output_linestyle(char* /*color*/, int width)
{
// Style settings for line strings
// For Earth 5.0 and later, we write a LookAt that encompasses
// the bounding box of our entire data set and set the event times
// to include all our data.
-void kml_write_AbstractView()
+static void kml_write_AbstractView()
{
double bb_size;
writer->writeEndElement(); // Close gx:SimpleArrayField tag
}
-void kml_write()
+static void kml_write()
{
const global_trait* traits = get_traits();
static gbfile* ofd;
static Waypoint* wpt_tmp;
-QString urllink;
-QString urllinkt;
+static QString urllink;
+static QString urllinkt;
static char* binary = nullptr;
#define MYNAME "lmx"
magrxstate = mrs_handoff;
}
-void
+static void
mag_verparse(char* ibuf)
{
int prodid = mm_unknown;
\r
*/\r
\r
-struct defguid {\r
+static struct defguid {\r
GUID guid;\r
const char *name;\r
} default_guids[] = {\r
print <<'END';\r
};\r
\r
-int FindIconByName( const char *name, GUID *guid ) {\r
+static int FindIconByName( const char *name, GUID *guid ) {\r
unsigned int i = 0; \r
for ( i = 0; i < (sizeof(default_guids)/sizeof(struct defguid)); i++ )\r
{\r
return 0;\r
}\r
\r
-int FindIconByGuid( GUID *guid, char **name ) {\r
+static int FindIconByGuid( GUID *guid, char **name ) {\r
unsigned int i = 0; \r
for ( i = 0; i < (sizeof(default_guids)/sizeof(struct defguid)); i++ )\r
{\r
geocache_container wpt_container(const QString&);
-void MapfactorRead()
+static void MapfactorRead()
{
Waypoint* wpt = nullptr;
gbfwrite(&c, 1, 1, mapsend_file_out);
}
-void mapsend_track_hdr(const route_head* trk)
+static void mapsend_track_hdr(const route_head* trk)
{
/*
* we write mapsend v3.0 tracks as mapsend v2.0 tracks get
}
-void mapsend_track_disp(const Waypoint* wpt)
+static void mapsend_track_disp(const Waypoint* wpt)
{
unsigned char c;
int32_t t;
}
}
-void
+static void
mapsend_track_write()
{
track_disp_all(mapsend_track_hdr, mapsend_noop, mapsend_track_disp);
/* no-op */
}
-void
+static void
mps_wpt_q_init(queue* whichQueue)
{
QUEUE_INIT(whichQueue);
}
-void
+static void
mps_wpt_q_deinit(queue* whichQueue)
{
queue* elem, *tmp;
* Find a waypoint that we've already written out
*
*/
-Waypoint*
+static Waypoint*
mps_find_wpt_q_by_name(const queue* whichQueue, const QString& name)
{
queue* elem, *tmp;
* Add a waypoint that we've already written out to our list
*
*/
-void
+static void
mps_wpt_q_add(const queue* whichQueue, const Waypoint* wpt)
{
Waypoint* written_wpt = new Waypoint(*wpt);
}
-void
+static void
mps_write()
{
int short_length;
static char* opt_status;
static char* opt_enable;
-arglist_t mtk_locus_args[] = {
+static arglist_t mtk_locus_args[] = {
{"baudrate", &opt_baudrate, "Speed in bits per second of serial port (autodetect=0)", "0", ARGTYPE_INT, ARG_NOMINMAX , nullptr},
{"download", &opt_download, "Download logged fixes", "1", ARGTYPE_BOOL, ARG_NOMINMAX, nullptr },
{"erase", &opt_erase, "Erase device data after download", "0", ARGTYPE_BOOL, ARG_NOMINMAX, nullptr },
DISTANCE,
} /* DATA_TYPES */;
-struct log_type {
+static struct log_type {
int id;
int size;
const char* name;
struct sat_info {
char id, used;
short elevation, azimut, snr;
-} sat_info;
+};
struct data_item {
time_t timestamp;
unsigned short timestamp_ms;
double distance;
struct sat_info sat_data[32];
-} data_item;
+};
struct mtk_loginfo {
unsigned int bitmask;
int logLen;
int period, distance, speed; /* in 10:ths of sec, m, km/h */
int track_event;
-} mtk_loginfo;
+};
/* *************************************** */
static char* OPT_block_size_kb; /* block_size_kb ? command option */
static enum MTK_DEVICE_TYPE mtk_device = MTK_LOGGER;
-struct mtk_loginfo mtk_info;
+static struct mtk_loginfo mtk_info;
const char LIVE_CHAR[4] = {'-', '\\','|','/'};
/********************* MTK Logger -- Parse functions *********************/
-int mtk_parse(unsigned char* data, int dataLen, unsigned int bmask)
+static int mtk_parse(unsigned char* data, int dataLen, unsigned int bmask)
{
static int count = 0;
int i, k, sat_id, hspd;
static Waypoint* nmea_rd_posn(posn_status*);
static void nmea_rd_posn_init(const QString& fname);
-arglist_t nmea_args[] = {
+static arglist_t nmea_args[] = {
{"snlen", &snlenopt, "Max length of waypoint name to write", "6", ARGTYPE_INT, "1", "64", nullptr },
{"gprmc", &opt_gprmc, "Read/write GPRMC sentences", "1", ARGTYPE_BOOL, ARG_NOMINMAX, nullptr },
{"gpgga", &opt_gpgga, "Read/write GPGGA sentences", "1", ARGTYPE_BOOL, ARG_NOMINMAX, nullptr },
return (double) deg + minutes;
}
-void
+static void
pcmpt_parse(char* ibuf)
{
int i, j1, j2, j3, j4, j5, j6;
return strncmp(s1,"$",1) || strncmp(s1+3,sentenceFormatterMnemonicCode,3) || strncmp(s1+6,",",1);
}
-void
+static void
nmea_parse_one_line(char* ibuf)
{
char* ck;
gb_sleep(sleepus);
}
}
-void
+static void
nmea_track_init(const route_head*)
{
last_time = -1;
}
-void
+static void
nmea_trackpt_pr(const Waypoint* wpt)
{
char obuf[200];
return fsdata;
}
-void
+static void
ozi_get_time_str(const Waypoint* waypointp, char* buff, gbsize_t buffsz)
{
if (waypointp->creation_time.isValid()) {
}
}
-void
+static void
ozi_set_time_str(const QString& str, Waypoint* waypointp)
{
double ozi_time = str.toDouble();
";waypts\n");
}
-void pcx_track_disp(const Waypoint* wpt) {
+static void pcx_track_disp(const Waypoint* wpt) {
double lon, lat;
lon = degrees2ddmm(wpt->longitude);
file_in = gbfopen_le(fname, "r", MYNAME);
}
-double wppos_to_dec(char* value)
+static double wppos_to_dec(char* value)
{
if (strstr(value, "\xB0") == nullptr) {
return atof(value);
#define BADVAL 999999
-void
+static void
polygon_process()
{
queue* elem, * tmp;
}
}
-void
+static void
polygon_init(const char*)
{
/* do nothing */
}
-void
+static void
polygon_deinit()
{
/* do nothing */
{
}
-void position_process()
+static void position_process()
{
int i = waypt_count();
track_disp_all(position_process_trk, position_noop_t, position_noop_w);
}
-void
+static void
position_init(const char*)
{
char* fm;
}
}
-void
+static void
position_deinit()
{
}
static char psit_current_token[256];
-char* snlen;
+static char* snlen;
static
arglist_t psit_args[] = {
/* no-op */
}
-void
+static void
psit_write()
{
int short_length;
}
-void
+static void
radius_process()
{
#if !NEWQ
xfree(comp);
}
-void
+static void
radius_init(const char*)
{
char* fm;
}
}
-void
+static void
radius_deinit()
{
if (home_pos) {
prev_new_trkseg = curr_new_trkseg;
}
-void
+static void
reverse_route_head(const route_head* rte)
{
route_reverse(rte);
prev_new_trkseg = 1;
}
-void
+static void
reverse_route_process()
{
track_disp_all(reverse_route_head, nullptr, reverse_route_wpt);
route_disp_all(reverse_route_head, nullptr, nullptr);
}
-void
+static void
reverse_route_init(const char*)
{
switch (global_opts.objective) {
}
}
-void
+static void
reverse_route_deinit()
{
/* do nothing */
#include "grtcirc.h"
#include <cstddef>
-gbfile* infile;
+static gbfile* infile;
-char* turns_important = nullptr;
-char* turns_only = nullptr;
-char* controls = nullptr;
-char* split = nullptr;
-char* timesynth = nullptr;
+static char* turns_important = nullptr;
+static char* turns_only = nullptr;
+static char* controls = nullptr;
+static char* split = nullptr;
+static char* timesynth = nullptr;
-int control = 0;
+static int control = 0;
static
arglist_t saroute_args[] = {
#define ReadShort(f) gbfgetint16(f)
#define ReadLong(f) gbfgetint32(f)
-unsigned char*
+static unsigned char*
ReadRecord(gbfile* f, gbsize_t size)
{
unsigned char* result = (unsigned char*) xmalloc(size);
return result;
}
-void
+static void
Skip(gbfile* f, gbsize_t distance)
{
gbfseek(f, distance, SEEK_CUR);
/* SHPOpenGpsbabel() */
/************************************************************************/
-SHPHandle SHPAPI_CALL
+static SHPHandle SHPAPI_CALL
SHPOpenGpsbabel(const QString& pszLayer, const char* pszAccess)
{
/* shape file with read/write access. */
/************************************************************************/
-SHPHandle SHPAPI_CALL
+static SHPHandle SHPAPI_CALL
SHPCreateGpsbabel(const QString& pszLayer, int nShapeType)
{
/* Open a .dbf file. */
/************************************************************************/
-DBFHandle SHPAPI_CALL
+static DBFHandle SHPAPI_CALL
DBFOpenGpsbabel(const QString& pszFilename, const char* pszAccess)
{
/* Create a new .dbf file. */
/************************************************************************/
-DBFHandle SHPAPI_CALL
+static DBFHandle SHPAPI_CALL
DBFCreateExGpsbabel(const QString& pszFilename, const char* pszCodePage)
{
}
+#ifdef DEAD_CODE_IS_REBORN
/************************************************************************/
/* DBFCreateGpsbabel() */
/* */
/* Create a new .dbf file with default code page LDID/87 (0x57) */
/************************************************************************/
-DBFHandle SHPAPI_CALL
+static DBFHandle SHPAPI_CALL
DBFCreateGpsbabel(const QString& pszFilename)
{
return DBFCreateExGpsbabel(pszFilename, "LDID/87"); // 0x57
}
+#endif
static
void dump_fields(void)
}
}
-void
+static void
my_read(void)
{
// option processing here instead of in my_rd_init
}
-void
+static void
my_rd_deinit(void)
{
SHPClose(ihandle);
ifname.clear();
}
-void
+static void
my_wr_init(const QString& fname)
{
ofname = fname;
}
-void
+static void
my_wr_deinit(void)
{
SHPClose(ohandle);
ofname.clear();
}
-void
+static void
my_write_wpt(const Waypoint* wpt)
{
SHPObject* shpobject;
CSTR(wpt->shortname));
}
-void
+static void
poly_init(const route_head* rte)
{
const int ct = rte->rte_waypt_ct;
}
-void
+static void
poly_point(const Waypoint* wpt)
{
polybufx[poly_count] = wpt->longitude;
poly_count++;
}
-void
+static void
poly_deinit(const route_head* rte)
{
SHPObject* shpobject;
}
-void
+static void
my_write(void)
{
// shape files can only contain one shape type in addition
* %%% SkyTraq protocol implementation %%% *
*******************************************************************************/
-uint8_t NL[2] = { 0x0D, 0x0A };
-uint8_t MSG_START[2] = { 0xA0, 0xA1 };
-uint8_t SECTOR_READ_END[13] = { 'E','N','D', 0, 'C','H','E','C','K','S','U','M','=' };
+static uint8_t NL[2] = { 0x0D, 0x0A };
+static uint8_t MSG_START[2] = { 0xA0, 0xA1 };
+static uint8_t SECTOR_READ_END[13] = { 'E','N','D', 0, 'C','H','E','C','K','S','U','M','=' };
static int
skytraq_calc_checksum(const unsigned char* buf, int len)
static char* opt_set_poi_boat = nullptr; /* set if a "poi" option was used */
static char* opt_set_poi_heart = nullptr; /* set if a "poi" option was used */
static char* opt_set_poi_bar = nullptr; /* set if a "poi" option was used */
-arglist_t miniHomer_args[] = {
+static arglist_t miniHomer_args[] = {
{ "baud", &opt_dlbaud, "Baud rate used for download", "115200", ARGTYPE_INT, "0", "115200", nullptr },
{ "dump-file", &opt_dump_file, "Dump raw data to this file", nullptr, ARGTYPE_OUTFILE, ARG_NOMINMAX, nullptr },
{ "erase", &opt_erase, "Erase device data after download", "0", ARGTYPE_BOOL, ARG_NOMINMAX, nullptr },
"Home", "Car", "Boat", "Heart", "Bar"
};
#define NUMPOI (sizeof poinames/sizeof poinames[0])
-int getPoiByName(char* name)
+#ifdef DEAD_CODE_IS_REBORN
+static int getPoiByName(char* name)
{
unsigned int i;
for (i=0; i<NUMPOI; i++) {
}
return -1;
}
+#endif
// Convert lla (lat, lng, alt) to ECEF
// Algorith taken from these sources:
// http://www.mathworks.com/matlabcentral/fileexchange/7942-covert-lat-lon-alt-to-ecef-cartesian
// http://en.wikipedia.org/wiki/Geodetic_system#From_ECEF_to_geodetic
// http://earth-info.nga.mil/GandG/publications/tr8350.2/wgs84fin.pdf
-void lla2ecef(double lat, double lng, double alt, double* ecef_x, double* ecef_y, double* ecef_z)
+static void lla2ecef(double lat, double lng, double alt, double* ecef_x, double* ecef_y, double* ecef_z)
{
long double n;
long double a = 6378137.0;
static char* xteopt;
static char* lenopt;
static char* relopt;
-void (*waypt_del_fnp)(route_head* rte, Waypoint* wpt);
+static void (*waypt_del_fnp)(route_head* rte, Waypoint* wpt);
static
arglist_t routesimple_args[] = {
const Waypoint* wpt;
};
-void
+static void
free_xte(struct xte* xte_rec)
{
xfree(xte_rec->intermed);
static const route_head* cur_rte = nullptr;
static struct xte* xte_recs = nullptr;
-void
+static void
routesimple_waypt_pr(const Waypoint* wpt)
{
if (!cur_rte) {
xte_count++;
}
-void
+static void
compute_xte(struct xte* xte_rec)
{
const Waypoint* wpt3 = xte_rec->intermed->wpt;
}
-int
+static int
compare_xte(const void* a, const void* b)
{
double distdiff = ((struct xte*)a)->distance -
return 0;
}
-void
+static void
routesimple_head(const route_head* rte)
{
cur_rte = nullptr;
}
-void
+static void
shuffle_xte(struct xte* xte_rec)
{
struct xte tmp_xte;
}
}
-void
+static void
routesimple_tail(const route_head* rte)
{
int i;
xfree(xte_recs);
}
-void
+static void
routesimple_process()
{
waypt_del_fnp = route_del_wpt;
track_disp_all(routesimple_head, routesimple_tail, routesimple_waypt_pr);
}
-void
+static void
routesimple_init(const char*)
{
count = 0;
}
}
-void
+static void
routesimple_deinit()
{
/* do nothing */
sm_time
} sort_mode_;
-sort_mode_ sort_mode = sm_shortname; /* How are we sorting these? */
+static sort_mode_ sort_mode = sm_shortname; /* How are we sorting these? */
static char* opt_sm_gcid, *opt_sm_shortname, *opt_sm_description, *opt_sm_time;
}
}
-void
+static void
sort_process()
{
sortqueue(&waypt_head, sort_comp);
}
-void
+static void
sort_init(const char*)
{
if (opt_sm_gcid) {
ARG_TERMINATOR
};
-struct stack_elt {
+static struct stack_elt {
queue waypts;
queue routes;
queue tracks;
}* stack = nullptr;
-void
+static void
stackfilt_process()
{
struct stack_elt* tmp_elt = nullptr;
}
}
-void
+static void
stackfilt_init(const char*)
{
}
-void
+static void
stackfilt_deinit()
{
swapdepth = 0;
}
-void
+static void
stackfilt_exit()
{
struct stack_elt* tmp_elt = nullptr;
/* arguments: definitions of format-specific arguments */
-arglist_t subrip_args[] = {
+static arglist_t subrip_args[] = {
// FIXME: document that gps_date and gps_time must be specified together or they will both be ignored and the timestamp of the first trackpoint will be used.
{"video_time", &opt_videotime, "Video position for which exact GPS time is known (hhmmss, default is 0:00:00)", nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr },
{"gps_time", &opt_gpstime, "GPS time at position video_time (hhmmss, default is first timestamp of track)", nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr },
#define read_long(f) gbfgetint32((f))
#define read_char(f) gbfgetc((f))
+#ifdef DEAD_CODE_IS_REBORN
/*
* Decode a type 8 compressed record
*/
-char*
+static char*
decode_8(int sz, const unsigned char* inbuf)
{
static const char encoding_8[] = "X. SaerionstldchumgpbkfzvACBMPG-";
}
return rval;
}
+#endif
-void
+#ifdef DEAD_CODE_IS_REBORN
+static void
decode_latlon(double* lat, double* lon)
{
unsigned char latbuf[3];
*lon = rlon = 123.456;
}
+#endif
static void
check_recsize(int sz)
/*******************************************************************************/
/* Define a global here that we can query from multiple places */
-float tpo_version = 0.0;
+static float tpo_version = 0.0;
/* tpo_check_version_string()
Check the first bytes of the file for a version 3.0 header. */
// that is the only type of data available in the version 2.x TPO
// files.
//
-void tpo_read_2_x()
+static void tpo_read_2_x()
{
char buff[16];
short track_count, waypoint_count;
//
// For version 3.x files.
//
-int tpo_read_int()
+static int tpo_read_int()
{
unsigned char val;
//
// For version 3.x files.
//
-int tpo_find_block(unsigned int block_desired)
+static int tpo_find_block(unsigned int block_desired)
{
unsigned int block_type;
unsigned int block_offset;
//
// For version 3.x files.
//
-Waypoint* tpo_convert_ll(int lat, int lon)
+static Waypoint* tpo_convert_ll(int lat, int lon)
{
double latitude;
double longitude;
// Track decoder for version 3.x files. This block contains tracks
// (called "freehand routes" or just "routes" in Topo).
//
-void tpo_process_tracks()
+static void tpo_process_tracks()
{
unsigned int track_count, track_style_count;
unsigned int xx,ii,tmp;
//
// For version 3.x files.
//
-Waypoint** tpo_wp_index;
-unsigned int tpo_index_ptr;
+static Waypoint** tpo_wp_index;
+static unsigned int tpo_index_ptr;
// Waypoint decoder for version 3.x files.
//
-void tpo_process_waypoints()
+static void tpo_process_waypoints()
{
unsigned int waypoint_count;
unsigned int ii;
// Map Notes decoder for version 3.x files.
//
-void tpo_process_map_notes()
+static void tpo_process_map_notes()
{
unsigned int waypoint_count;
unsigned int ii;
// Symbols decoder for version 3.x files.
//
-void tpo_process_symbols()
+static void tpo_process_symbols()
{
unsigned int waypoint_count;
unsigned int ii;
// Text Labels decoder for version 3.x files.
//
-void tpo_process_text_labels()
+static void tpo_process_text_labels()
{
unsigned int waypoint_count;
unsigned int ii;
// with pointers to waypoint objects by tpo_process_waypoints()
// function above.
//
-void tpo_process_routes()
+static void tpo_process_routes()
{
unsigned int route_count;
unsigned int ii;
+#ifdef DEAD_CODE_IS_REBORN
// Compass decoder for version 3.x files.
//
-void tpo_process_compass()
+static void tpo_process_compass()
{
// Not implemented yet
}
+#endif
// (called "freehand routes" or just "routes" in Topo), "waypoints",
// and "gps-routes". We intend to read all three types.
//
-void tpo_read_3_x()
+static void tpo_read_3_x()
{
if (doing_trks) {
}
/* copied from dg-100.c - slight (incompatible) modification to how the date parameter is used */
-QDateTime
+static QDateTime
bintime2utc(int date, int time) {
int secs = time % 100;
time /= 100;
#define MYNAME "validate"
static char* opt_debug;
-bool debug;
+static bool debug;
static char* opt_checkempty;
-bool checkempty;
+static bool checkempty;
static unsigned int point_ct;
static unsigned int head_ct;
static unsigned int segment_ct_start;
#define MYNAME "vpl"
-void vpl_parse_75_sentence(const char*);
+static void vpl_parse_75_sentence(const char*);
static
arglist_t vpl_args[] = {
}
}
-void
+static void
wfff_xml_rd_init(const QString& fname)
{
tosscount = 0;
}
void
-wfff_xml_read()
+static wfff_xml_read()
{
xml_read();
}
void
-wfff_xml_rd_deinit()
+static wfff_xml_rd_deinit()
{
xml_deinit();